//
//  WBComposeTypeButton.swift
//  Weibo
//
//  Created by cc on 10/27/17.
//  Copyright © 2017 cc. All rights reserved.
//

import UIKit


//UIControl 内置了 touchupInside事件响应
class WBComposeTypeButton: UIControl {
    
    @IBOutlet weak var imageView: UIImageView!
    @IBOutlet weak var titleLabel: UILabel!
    
    //点击按钮撰写要展示控制器的类型
    var clsName: String?
    
    /// 使用图像名称 / 标题创建按钮， 按钮布局从xib加载
    class func composeTypeButton(imageName: String, title: String) -> WBComposeTypeButton {
        let nib = UINib(nibName: "WBComposeTypeButton", bundle: nil)
        
        let btn = nib.instantiate(withOwner: nil, options: nil)[0] as! WBComposeTypeButton
        
        btn.imageView.image = UIImage(named: imageName)
        btn.titleLabel.text = title
       
        return btn
    }
    
}
